//
//  clsGhost.cpp
//  NewMath
//
//  Created by Ngô Hoàng Nam on 12/27/14.
//
//

#include "ResultGhostObj.h"
#include "../../../GamePlayConfig.h"
#include "../PlayConfig.h"

ResultGhostObj::ResultGhostObj(){}

void ResultGhostObj::initGhost(std::string ghostSprite, std::string text, cocos2d::Vec2 Position, float canvasHeight,EGameStatus gameStatus)
{
    Sprite* ghostTemp = Sprite::create("ghost_red.png");
    float kScale = canvasHeight/ghostTemp->getContentSize().height;
    
    BaseGhostObj::initGhost(ghostSprite, Position, kScale);
    
    float newWidthGhost = m_Ghost->getContentSize().width*kScale;
    float newHeightGhost = m_Ghost->getContentSize().height*kScale;
    
    m_clound = Sprite::create("clound.png");
    m_clound->setPosition(Vec2(m_Ghost->getPosition().x,m_Ghost->getPosition().y + newHeightGhost));
    LabelTTF* label= LabelTTF::create(text, "Arial", m_clound->getContentSize().height/2);
    label->setPosition(m_clound->getContentSize().width/2,m_clound->getContentSize().height/3);
    m_clound->addChild(label);
    
    m_clound->setScale(kScale);
    this->addChild(m_clound);

    if(gameStatus == EGameStatus::Fail)
    {

        
        Sprite* sprfail = Sprite::create("fail-icon.png");
        sprfail->setScale(kScale);
        sprfail->setPosition(m_clound->getPosition());
        m_clound->setColor(Color3B::RED);
        //m_Root->addChild(m_clound);
        this->addChild(sprfail);
        
      
    }

    
}

